<?php

namespace app\common\validate;

use think\Validate;

class Admin extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'company_name' => 'require',
        'contacts' => 'require',
        'contacts_phone'   => 'require|regex:1[3-9]\d{9}',
        'description' => 'require|regex:\S{32}' 
    ];

    /**
     * 提示消息
     */
    protected $message = [
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'company_name' => '公司名称',
            'contacts' => '联系人',
            'contacts_phone'   => '联系方式',
            'description' => '业务描述'
        ];
        $this->message = array_merge($this->message, [
            'contacts_phone.regex' => '请输入正确手机号',
        ]);
        parent::__construct($rules, $message, $field);
    }

}
